package com.UI
{
	import com.*;
	import com.Engine.*;
	import com.Packet.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.external.*;
	import flash.filters.*;
	import flash.geom.*;
	import flash.system.*;
	import flash.text.*;
	import flash.ui.*;
	import flash.utils.*;
	
	import org.aswing.*;
	import org.aswing.border.*;
	import org.aswing.border.EmptyBorder;
	import org.aswing.colorchooser.*;
	import org.aswing.ext.*;
	import org.aswing.geom.*;
	public class ToolTipBattler extends JToolTip
	{
		protected var panelToolTipSkill:PanelToolTipBattler;
		public function ToolTipBattler()
		{
			this.setBackground(new ASColor(0,0));
			this.setForeground(new ASColor(0,0));
			this.setBackgroundDecorator(null);
			var layout0:EmptyLayout = new EmptyLayout();
			setLayout(layout0);
			
			panelToolTipSkill = new PanelToolTipBattler();
			panelToolTipSkill.setLocation(new IntPoint(0, 0));
			panelToolTipSkill.setSize(new IntDimension(200, 200));
			append(panelToolTipSkill);
			this.setClipMasked(false);
		}
		
		private var _item:Object;
		private var icon_id:int = 0;
		
		public function setItem(item:Object):void 
		{
			setTipText("");
			var width:int = 200;
			var height:int = 100;
			panelToolTipSkill.setItem(item);
			height = panelToolTipSkill.height;
			this.setPreferredWidth(200);
			setSize(new IntDimension(width, height));
			this.pack();
			this.paintImmediately();
			return;
		}
		public function clear():void
		{
			setBackgroundDecorator(null);
			//panelIcon.setBackgroundDecorator(null);
		}
	}
}

import com.*;
import com.Engine.*;
import com.Packet.*;
import com.UI.*;

import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;

import org.aswing.*;
import org.aswing.border.*;
import org.aswing.border.EmptyBorder;
import org.aswing.colorchooser.*;
import org.aswing.ext.*;
import org.aswing.geom.*;
/**
 * ToolTipItem
 */
class PanelToolTipBattler extends JPanel{
	
	
	//members define
	protected var panelTop:JPanel;
	protected var labelName:JLabel;
	protected var panelBottom:JPanel;
	protected var textField:MultilineLabel;
	
	/**
	 * ToolTipItem Constructor
	 */
	public function PanelToolTipBattler()
	{
		//component creation
		setLocation(new IntPoint(0, 0));
		setSize(new IntDimension(150, 69));
		var layout0:BorderLayout = new BorderLayout();
		layout0.setHgap(0);
		layout0.setVgap(0);
		setLayout(layout0);
		
		panelTop = new JPanel();
		panelTop.setLocation(new IntPoint(5, 5));
		panelTop.setSize(new IntDimension(150, 26));
		panelTop.setPreferredSize(new IntDimension(150, 26));
		panelTop.setConstraints("North");
		var layout1:EmptyLayout = new EmptyLayout();
		panelTop.setLayout(layout1);
		
		labelName = new JLabel();
		labelName.setLocation(new IntPoint(10, 10));
		labelName.setSize(new IntDimension(130, 16));
		labelName.setPreferredSize(new IntDimension(130, 16));
		labelName.setText("label");
		
		panelBottom = new JPanel();
		panelBottom.setLocation(new IntPoint(0, 26));
		panelBottom.setSize(new IntDimension(150, 26));
		var layout2:CenterLayout = new CenterLayout();
		panelBottom.setLayout(layout2);
		
		textField = new MultilineLabel();
		textField.setLocation(new IntPoint(50, 11));
		textField.setSize(new IntDimension(100, 4));
		
		//component layoution
		append(panelTop);
		append(panelBottom);
		
		panelTop.append(labelName);
		
		panelBottom.append(textField);
		
		//-------------------------------------------------------
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 14, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelName.setFont(font);
		labelName.setForeground(ASColor.WHITE);
		labelName.setTextFilters(new Array(filter));
		
		textField.setBackgroundDecorator(null);
		textField.setWordWrap(true);
		textField.setFont(new ASFont("宋体", 13, false, false, false, false));
		textField.setForeground(ASColor.WHITE);
		textField.setPreferredWidth(130);
		//var filter:GlowFilter;
		//filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		textField.filters = (new Array(filter));
		//setItem(item);
		//this.setBackground(new ASColor(0x033300,1.0));
		
		//setBorder(new LineBorder(null,new ASColor(0xeeeeee,1.0)));
		//textField.setBounds(new IntRectangle(5,5,5,5));

	}
	private var _item:Object;
	private var icon_id:int = 0;
	//private var filterArrayImage:Array = new Array(new GlowFilter(0xEA0000, 0.6, 34, 34, 2,1,true));
	public function setItem(item:Object):void 
	{
		//setTipText("");
		textField.setHtmlText("");
		_item = null;
		//panelIcon.setBackgroundDecorator(null);
		if(item == null)
		{
			icon_id = 0;
			return;
		}
		
		_item = item;
		labelName.setText(_item.name+' Lv.' + _item.m_nLevel);
		//labelLevel.setText(' Lv.' + _item.m_nLevel);
		
		var text:String = new String;
		

		text += "生命:   "+'<font color="#FFFF00">'+_item.m_nHP + '/'+ _item.m_nHPMax +"</font>\n";
		text += "攻击:   "+'<font color="#FFFF00">'+_item.m_nAP +"</font>\n";
		text += "防御:   "+'<font color="#FFFF00">'+_item.m_nDP +"</font>\n";
		text += "速度:   "+'<font color="#FFFF00">'+_item.m_nSP +"</font>\n";
		
		text += "抗混乱:   "+'<font color="#FFFF00">'+_item.m_nResistHL +"</font>\n";
		text += "抗冰冻:   "+'<font color="#FFFF00">'+_item.m_nResistBD +"</font>\n";
		text += "抗昏睡:   "+'<font color="#FFFF00">'+_item.m_nResistHS +"</font>\n";
		
		
		textField.setHtmlText(text);
		textField.pack();
		textField.paintImmediately();
		panelBottom.pack();
		panelBottom.paintImmediately();
		var square:Sprite = new Sprite();
		
		square.graphics.beginFill(0x033332, 0.9);
		square.graphics.drawRoundRectComplex(0,0,width,height,5,5,5,5);
		square.graphics.endFill();
		setBackgroundDecorator(new AssetBackground(square as DisplayObject));
		
		this.pack();
		this.paintImmediately();
		
	}	
}